package adapter;


import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import androidx.viewpager.widget.PagerAdapter;


/**
 * ViewPager适配器
 * Create by: chenwei.li
 * Date: 2017/12/8
 * time: 15:17
 * Email: lichenwei.me@foxmail.com
 */

public class DatePagerAdapter extends PagerAdapter {

    public interface CallBackPagerAdapter {
        public void onCallBackCurrentPage(int page, String date);
    }

    private Context mContext;

    private int STYLE;//1.表示 "周"   2.表示"月"    3.表示"年"

    private int dayCounts;//天数，
    private int dfd;

    public DatePagerAdapter(Context context, int style) {
        this.mContext = context;
        this.STYLE = style;
    }


    public void setDaysCountd(int dayCounts){
        this.dayCounts=dayCounts;

    }
    public void setStyle(int style){
        this.STYLE = style;

    }


    @Override
    public int getCount() {
        return Integer.MAX_VALUE;
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {




        return null;


    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView((View) object);
    }


//    /**
//     * 获取本周的周一到周日
//     */
//    private String getMondayToWeekdayByCurrentWeek(Date startTime) {
//        //通过调整日历，获得本天所属周的周一和周日
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//        Calendar cal = new GregorianCalendar();
//        cal.setFirstDayOfWeek(Calendar.MONDAY);
//        cal.setTime(startTime);
//        cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
//        String startTime1 = sdf.format(cal.getTime());
//        cal.set(Calendar.DATE, cal.get(cal.DATE) + 6);
//        String endTime1 = sdf.format(cal.getTime());
//        return startTime1 + "~" + endTime1;
//    }
//
//    /**
//     * 根据本周的时间获得上周的周一和周日
//     */
//    public String getMondayToWeekdayByLastWeek(Date startTime, int currentFlag) throws ParseException {
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//        Calendar calendar = Calendar.getInstance();
//        calendar.setTime(startTime);
//        calendar.add(Calendar.DATE, -7 * currentFlag);
//        Date d = calendar.getTime();
//        String day = sdf.format(d);
//        System.out.println("过去七天：" + day);
//        getMonthByCurrentTime(startTime,currentFlag);
//        return getMondayToWeekdayByCurrentWeek(d);
////        return  sdf.format(calendar.getTime())+"~"+sdf.format(calendar.getTime());
//
//    }
//    //根据当前时间获取当前的年份
//    public String getYear(Date startTime, int currentFlag) {
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//        Calendar calendar = Calendar.getInstance();
//        calendar.setTime(startTime);
//        calendar.add(Calendar.YEAR, -currentFlag);
//        Date d = calendar.getTime();
//        String day = sdf.format(d);
//        System.out.println("年：" + day);
//        return day;
//    }
//
////根据当前时间获取当前的月份
//    public String getMonthByCurrentTime(Date startTime, int currentFlag) {
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//
//        Calendar a = Calendar.getInstance();
//        a.add(Calendar.MONTH, -1 * currentFlag);
//
//        a.set(Calendar.DATE, 1);//把日期设置为当月第一天
//
//        String firstDay = sdf.format(a.getTime());
//
//        a.roll(Calendar.DATE, -1);//日期回滚一天，也就是最后一天
//
//        String endDay = sdf.format(a.getTime());
//
//        int maxDate = a.get(Calendar.DATE);
//        return firstDay + "～" + endDay  ;
//
//    }
////根据当前时间获取当前的月份的天数
//    public int getMonthDayCounts(Date startTime, int currentFlag) {
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//
//        Calendar a = Calendar.getInstance();
//        a.add(Calendar.MONTH, -1 * currentFlag);
//
//        a.set(Calendar.DATE, 1);//把日期设置为当月第一天
//
//        String firstDay = sdf.format(a.getTime());
//
//        a.roll(Calendar.DATE, -1);//日期回滚一天，也就是最后一天
//
//        String endDay = sdf.format(a.getTime());
//
//        int maxDate = a.get(Calendar.DATE);
//        return maxDate ;
//
//    }


}
